#include<bits/stdc++.h>
using namespace std;

const int N = 1e5 + 10;
vector<int>v[N];
int d[N], a[N], cnt, w[N];
void dfs(int x, int fa) {
	a[++cnt] = x;
	w[x] = cnt;
	for(int i = 0; i < v[x].size(); i++) {
		int y = v[x][i];
		if(y == fa) continue;
		dfs(y, x);
	}
}
int main() {
	freopen("nim.in", "r", stdin);
	freopen("nim.out", "w", stdout);
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n, X, A, B;
	cin >> n >> X >> A >> B;
	for(int i = 1; i < n; i++) {
		int x, y;
		cin >> x >> y;
		d[x]++;
		d[y]++;
		v[x].push_back(y);
		v[y].push_back(x);
	}
	int cnt1 = 0, cnt2 = 0;
	for(int i = 1; i <= n; i++) {
		if(d[i] == 2) ++cnt2;
		if(d[i] == 1) ++cnt1;
	}
	if(cnt1 == 2 && cnt2 == n - 2 && d[X] == 1) {
		
		if(A <= B) cout << 1 << endl;
		else {
			int ans = 1e9;
			dfs(X, 0);
			for(int i = A + 1; i + A <= n; i += A) {
				for(int j = 1; j <= B && i - j >= 1; j++) {
					ans = min(ans, a[i - j]);
				}
				for(int j = 1; j < B - 1 && i + j <= n; j++) {
					ans = min(ans, a[i + j]);
				}
			}
			ans = min(ans, a[n]);
			cout << ans << endl;
		}
		
	}
	else {
		cout << 1;
	}
}
